package com.mkx.multitier.resource;

/**
 * 资源分配异常，表示无法分配所需资源
 */
public class ResourceAllocationException extends RuntimeException {
    private final String resourceType;
    private final String reason;
    
    public ResourceAllocationException(String resourceType, String reason) {
        super("Failed to allocate resource of type '" + resourceType + "': " + reason);
        this.resourceType = resourceType;
        this.reason = reason;
    }
    
    public ResourceAllocationException(String resourceType, String reason, Throwable cause) {
        super("Failed to allocate resource of type '" + resourceType + "': " + reason, cause);
        this.resourceType = resourceType;
        this.reason = reason;
    }
    
    /**
     * 获取资源类型
     */
    public String getResourceType() {
        return resourceType;
    }
    
    /**
     * 获取失败原因
     */
    public String getReason() {
        return reason;
    }
}
